package com.hou.resourceserver.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController {
    //不需要权限
    @GetMapping("/hou")
    public String test01(){
        return "返回测试数据hou";
    }
    @PreAuthorize("hasAnyAuthority('ROLE_USER')") //需要权限
    @GetMapping("/zheng")
    public String test02(){
        return "返回测试数据zheng";
    }
}
